package com.keyue.isolate.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;


@Getter
@AllArgsConstructor
public enum DataPermissionModelEnum {

    ORDER_QY("100", "企业订单"),
    ORDER_LS("101", "零售订单"),
    ORDER_XX_PLAN("102", "线下计划"),
    ORDER_XX("103", "线下订单"),
    ORDER_WAIT_MATCH("104", "待匹配订单"),
    ORDER_OUT("105", "外部订单"),
//    ORDER_EXPORT("106", "出口订单"),
//    ORDER_SG("107", "事故跟踪单"),


    TRANSPORT_PLAT("200", "运输平台"),


    FINANCE_SH("300", "收货凭证"),
    //301和302是同一个接口的数据权限 考虑合并掉
    FINANCE_PRICE("301", "承运商运价表"),
    FINANCE_MRD_PRICE("302", "明睿达承运商运价表"),
    FINANCE_CPK_BILL("303", "成品库对账单"),
    FINANCE_MRD_BILL("304", "明睿达对账单"),
    FINANCE_IN_OUT("305", "出入库数据"),
    FINANCE_ZX_PRICE("306", "装卸货价格"),
    FINANCE_ZX_PZ("307", "装卸货凭证"),
    FINANCE_ZX_BILL("308", "装卸费账单"),
    FINANCE_ZX_BT("309", "装卸货补贴"),


    BUSINESS("400", "业务伙伴"),

    CUSTOMER("500", "客户管理"),

    ALL_VIEW("600", "全链路看板"),
    ALL_GX_VIEW("601", "干线网批看板"),

    STORAGE_FEE_BILL("700", "仓储费对账单"),
    EXPORT_ORDER("701", "出口订单"),
    EXPORT_PLAN("702", "上柜计划"),
    EXPORT_PORT("703", "港口出入闸信息"),


    ;

    private String modelType;

    private String modelName;

    public static String getModelNameBy(String modelType) {
        for (DataPermissionModelEnum modelEnum : DataPermissionModelEnum.values()) {
            if (modelEnum.modelType.equals(modelType)) {
                return modelEnum.getModelName();
            }
        }
        return null;
    }


    /**
     * 来源平台
     *
     * @return
     */
    public static List<String> getSourcePlatformList() {
        return Arrays.asList(ORDER_QY.getModelType(), ORDER_LS.getModelType(),
                ORDER_XX_PLAN.getModelType(),
                ORDER_WAIT_MATCH.getModelType());
    }

    /**
     * 仓库编码
     *
     * @return
     */
    public static List<String> getWarehouseCodeList() {
        return Arrays.asList(ORDER_QY.getModelType(), ORDER_LS.getModelType(),
                ORDER_XX_PLAN.getModelType(), ORDER_XX.getModelType(),
                ORDER_OUT.getModelType(), ORDER_WAIT_MATCH.getModelType(),
                FINANCE_SH.getModelType(), FINANCE_PRICE.getModelType(),
                FINANCE_MRD_PRICE.getModelType(), FINANCE_CPK_BILL.getModelType(),
                FINANCE_MRD_BILL.getModelType(), FINANCE_IN_OUT.getModelType(),
                FINANCE_ZX_PRICE.getModelType(), FINANCE_ZX_PZ.getModelType(),
                FINANCE_ZX_BILL.getModelType(), FINANCE_ZX_BT.getModelType(),
                STORAGE_FEE_BILL.getModelType(),
                BUSINESS.getModelType(), ALL_VIEW.getModelType(), ALL_GX_VIEW.getModelType(),
                EXPORT_ORDER.getModelType(), EXPORT_PLAN.getModelType(), EXPORT_PORT.getModelType());
    }

    /**
     * 承运商公司
     *
     * @return
     */
    public static List<String> getCompanyCodeList() {
        return Arrays.asList(FINANCE_PRICE.getModelType(),
                FINANCE_MRD_PRICE.getModelType(), FINANCE_CPK_BILL.getModelType(),
                FINANCE_MRD_BILL.getModelType(), TRANSPORT_PLAT.getModelType());
    }


    /**
     * 承运商
     *
     * @return
     */
    public static List<String> getCarrierCodeList() {
        return Arrays.asList(ORDER_QY.getModelType(), ORDER_LS.getModelType(),
                ORDER_XX_PLAN.getModelType(), ORDER_XX.getModelType(),
                EXPORT_ORDER.getModelType());
    }

    /**
     * 承运类型
     *
     * @return
     */
    public static List<String> getTransportTypeCodeList() {
        return Arrays.asList(FINANCE_PRICE.getModelType(),
                FINANCE_MRD_PRICE.getModelType(), FINANCE_CPK_BILL.getModelType(),
                FINANCE_MRD_BILL.getModelType());
    }

    /**
     * 承运子类型
     *
     * @return
     */
    public static List<String> getSubTransportTypeCodeList() {
        return Arrays.asList(FINANCE_PRICE.getModelType(),
                FINANCE_MRD_PRICE.getModelType(), FINANCE_CPK_BILL.getModelType(),
                FINANCE_MRD_BILL.getModelType());
    }


    /**
     * 下单客户
     *
     * @return
     */
    public static List<String> getCustomerList() {
        return Arrays.asList(ORDER_QY.getModelType(), ORDER_LS.getModelType(),
                ORDER_XX_PLAN.getModelType(), ORDER_XX.getModelType(), ORDER_OUT.getModelType());
    }

    /**
     * 合同主体
     *
     * @return
     */
    public static List<String> getContractBodyList() {
        return Arrays.asList(FINANCE_PRICE.getModelType());
    }

    public static List<String> getFromCityCodeList() {
        return Arrays.asList(FINANCE_PRICE.getModelType(), FINANCE_MRD_PRICE.getModelType());
    }

}
